home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 9 / FM Towns Free Software Collection 9.iso / t_os / shell / tsbgex / src / win / fb16.asm < prev    next >
Encoding:
Assembly Source File  |  1994-11-16  |  1.3 KB  |  83 lines

  1.     assume    cs:text
  2. text    segment para public 'CODE'
  3.  
  4.     extrn    vramoff:dword
  5.     public    fbread16
  6. fbread16 proc    near
  7.     push    ebp
  8.     push    ebx
  9.     push    ecx
  10.     push    edx
  11.     push    esi
  12.     push    edi
  13.     mov    edi,28[esp]    ; edi <-- save
  14.     mov    edx,36[esp]    ; edx <-- y
  15.     shl    edx,10        ; y * 1024
  16.     mov    eax,32[esp]    ; eax <-- x
  17.     add    eax,eax        ; x * 2
  18.     add    edx,eax
  19.     add    edx,vramoff    ; edx <-- vram address
  20.     mov    ebp,40[esp]    ; ebp <-- width
  21.     mov    ebx,44[esp]    ; ebx <-- height
  22. #0:
  23.     mov    esi,edx        ; esi <-- vram
  24.     mov    ecx,ebp        ; ecx <-- width
  25. #1:
  26.     mov    ax,fs:[esi]
  27.     mov    [edi],ax
  28.     add    esi,2
  29.     add    edi,2
  30.     loop    #1
  31.     
  32.     add    edx,0400H
  33.     dec    ebx
  34.     jne    SHORT #0
  35.     pop    edi
  36.     pop    esi
  37.     pop    edx
  38.     pop    ecx
  39.     pop    ebx
  40.     pop    ebp
  41.     ret
  42. fbread16 endp
  43.  
  44.     public    fbwrite16        
  45. fbwrite16 proc    near
  46.     push    ebx
  47.     push    ecx
  48.     push    edx
  49.     push    esi
  50.     push    edi
  51.     push    es
  52.     mov    ax,fs
  53.     mov    es,ax
  54.     mov    esi,28[esp]    ; esi <-- buf
  55.     mov    edx,36[esp]    ; edx <-- y
  56.     shl    edx,10        ; y * 1024
  57.     mov    eax,32[esp]    ; eax <-- x
  58.     add    eax,eax        ; x * 2
  59.     add    edx,eax
  60.     add    edx,vramoff    ; edx <-- vram offset
  61.     mov    eax,40[esp]    ; eax <-- width
  62.     mov    ebx,44[esp]    ; ebx <-- height
  63.     cld
  64. #0:
  65.     mov    edi,edx        ; edi <-- vram
  66.     mov    ecx,eax        ; ecx <-- width
  67.     rep    movsw
  68.     add    edx,0400H
  69.     add    esi,48[esp]
  70.     dec    ebx
  71.     jne    SHORT #0
  72.     pop    es
  73.     pop    edi
  74.     pop    esi
  75.     pop    edx
  76.     pop    ecx
  77.     pop    ebx
  78.     ret
  79. fbwrite16 endp
  80.  
  81. text    ends
  82.     end
  83.